<template>
	<div class="box box12 pr">
		<h1 class="tac" style="text-decoration: underline;">C VTC PROFIT AND LOSS JOB SHEET</h1>		
		<h6 class="tar" style="font-weight:normal;">{{data.tzid}}</h6>
		<table class="table121">
			<tbody>
				<tr>
					<td class="w10">JOB NO.</td>
					<td class="w23" colspan="2">{{ data.jobno }}</td>
					<td class="w10">MNTR NO.</td>
					<td class="w23" colspan="2">{{ data.mntrno }}</td>
					<td class="w10">HB/L NO.</td>
					<td class="w24" colspan="2">{{ data.hbl }}</td>
				</tr>
				<tr>
					<td>V/V</td>
					<td colspan="2">{{ data.vesselvoy }}</td>
					<td>OBL/ NO.</td>
					<td colspan="2">{{data.ybh}}</td>
					<td>POR</td>
					<td colspan="2"></td>
				</tr>
				<tr>
					<td>POL</td>
					<td colspan="2">{{data.portload}}</td>
					<td>POD</td>
					<td colspan="2">{{data.portdis}}</td>
					<td>SD/ETA</td>
					<td class="w12">{{ data.etd }}</td>
					<td>{{ data.nextetd }}</td>
				</tr>

				<tr>
					<td>SALES/TYPE</td>
					<td class="w12">{{data.saler}}</td>
					<td>FM</td>
					<td>SHIPPER</td>
					<td colspan="2">{{data.shipper}}</td>
					<td>CSNEE</td>
					<td colspan="2">{{data.csnee}}</td>
				</tr>

				<tr>
					<td>VOLUME/NO</td>
					<td class="w12">{{ data.saler }}</td>
					<td colspan="7">{{ data.cntrno }}</td>
				</tr>
			</tbody>
		</table>
		<doc13 :list="data.itemList"></doc13>

		<div class="clearfix tip12">
			<div class="fl clearfix">
				<span class="fl tar">PREPARED BY</span>
				<span class="inner">{{ op.nickname ||data.op }}</span>
			</div>
			<div class="fl clearfix">
				<span class="fl tar">CHECKED& APPROVED BY</span>
				<span class="inner"></span>
			</div>
			<div class="fl clearfix">
				<span class="fl tar">DATE</span>
				<span class="inner">{{date.year}}/{{date.month}}/{{ date.day }}</span>
			</div>
			<div class="fl clearfix">
				<span class="fl tar">DATE</span>
				<span class="inner"></span>
			</div>
		</div>
	</div>
</template>
<script setup lang="ts">

import { computed, onMounted, reactive } from "vue"
import doc13 from './doc13.vue'

interface Props {
    bjno:string,
		data:anyObj,
		date:anyobj,
		op:anyObj
}

const props = withDefaults(defineProps<Props>(), {
    bjno: '',
		data:{},
		date:{},
		op:{},
})


//相关计算逻辑
const cal_1 = (item:any)=>{
	return (item.rmb0  / (1 + item.taxrate)).toFixed(2)
}

const cal_2 = (item:any)=>{
	return ((item.usd0 * item.usdrate  / (1 + item.taxrate))/item.usdrate).toFixed(2)
}

const cal_3 = (item:any)=>{
	return (item.rmb0 + (item.usd0*item.usdrate) -  (item.rmb0 + item.usd0*item.usdrate)  / (1 + item.taxrate)).toFixed(2)
}
const cal_4 = (item:any)=>{
	return (item.rmb1  /  ( 1 + item.taxrate)).toFixed(2)
}

const cal_5 = (item:any)=>{
	return ((item.usd1*item.usdrate / ( 1 + item.taxrate)) / item.usdrate).toFixed(2)
}
const cal_6 = (item:any)=>{
	return (item.rmb1 + (item.usd1*item.usdrate) -  (item.rmb1 + item.usd1*item.usdrate) / (1 + item.taxrate)).toFixed(2)
}
//总计相关
const sub_total = computed(()=>{
	let obj = {
		total_1:0,
		total_2:0,
		total_3:0,
		total_4:0,
		total_5:0,
		total_6:0,
		profit:0
	}
	props.data.itemList.map((item:any)=>{
		obj.total_1 += Number(cal_1(item))
		obj.total_2 += Number(cal_2(item))
		obj.total_3 += Number(cal_3(item))
		obj.total_4 += Number(cal_4(item))
		obj.total_5 += Number(cal_5(item))
		obj.total_6 += Number(cal_6(item))
	})
	obj.profit = Number((obj.total_2 - obj.total_5 + (obj.total_1 - obj.total_4) / props.data.usdrate).toFixed(2))

	return obj
})



</script>

<style lang="scss" scoped>
@import '../../../../styles/print.css';
</style>